<template lang="">
  <div>
    <el-row>
      <el-col :span="3"> </el-col>
      <el-col :span="4" style="text-align: center"> </el-col>

      <el-col :span="8">
        <el-button
          @click="company_name_click(0)"
          icon="el-icon-search"
          class="add_btn"
        >
          搜索</el-button
        >
        <el-button
          icon="el-icon-refresh"
          @click="company_name_clicks"
          class="add_btn"
        >
          重置</el-button
        >
        <el-button @click="dayin" class="add_btn"> 打印</el-button>
      </el-col>
    </el-row>

    <el-table
      :data="dataList"
      stripe
      style="width: 100%"
      border
    >
      <el-table-column prop="id" label="ID" width="60"> </el-table-column>
      <el-table-column prop="warehouse_entry_time" label="入库日期" width="100">
      </el-table-column>
      <el-table-column label="客户名称" width="80">
        <template slot-scope="scope">
          {{
            scope.row.order.customer
              ? scope.row.order.customer.customer_name
              : ""
          }}
        </template>
      </el-table-column>
      <el-table-column label="订单号" width="70">
        <template slot-scope="scope">
          {{ scope.row.order.order_number }}
        </template>
      </el-table-column>
      <el-table-column label="流水号" width="70">
        <template slot-scope="scope">
          {{ scope.row.order.serial_number }}
        </template>
      </el-table-column>

      <el-table-column label="产品名称" width="80">
        <template slot-scope="scope">
          {{ scope.row.order.product_name.product_name }}
        </template>
      </el-table-column>
      <el-table-column label="产品型号" width="80">
        <template slot-scope="scope">
          {{ scope.row.order.model_number_name.model_number }}
        </template>
      </el-table-column>
      <el-table-column label="方向" width="120">
        <template slot-scope="scope">
          {{ scope.row.direction }}
        </template>
      </el-table-column>
      <el-table-column label="规格" width="70">
        <template slot-scope="scope">
          {{
            scope.row.order.specification
              ? scope.row.order.specification.specification
              : ""
          }}
        </template>
      </el-table-column>
      <el-table-column label="颜色" width="70">
        <template slot-scope="scope">
          {{ scope.row.order.color ? scope.row.order.color.color : "" }}
        </template>
      </el-table-column>
      <el-table-column label="备注" width="120">
        <template slot-scope="scope">
          {{ scope.row.order.remark }}
        </template>
      </el-table-column>
      <el-table-column label="盘点状态" width="120">
        <template slot-scope="scope">
            <span v-if="scope.row.is_check==2" style="color:#333;font-weight:bold;">未盘点</span>    
            <span v-if="scope.row.is_check==1" style="color:green;font-weight:bold;">已盘点</span>    
        </template>
      </el-table-column>
      <el-table-column prop="logistics_status" label="发货状态" width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.logistics_status == 1" style="color: #dd8211"
            >待发货</span
          >
          <span v-if="scope.row.logistics_status == 2" style="color: #f1420d"
            >未发货</span
          >
          <span v-if="scope.row.logistics_status == 4" style="color: #b47425"
            >部分待发货</span
          >
          <span v-if="scope.row.logistics_status == 5" style="color: #b47425"
            >部分未发货</span
          >
          <span v-if="scope.row.logistics_status == 3" style="color: #0ca747"
            >已发货</span
          >
        </template>
      </el-table-column>
      <el-table-column label="件数" prop="num"  width="70">
      </el-table-column>
      <el-table-column label="仓库" width="120">
        <template slot-scope="scope">
          {{scope.row.warehouse.warehouse_name }}
        </template>
      </el-table-column>
      <el-table-column label="货架" width="120">
        <template slot-scope="scope">
          {{scope.row.warehouse.warehouse_name }}
        </template>
      </el-table-column>
      
    </el-table>

    <div class="pagination">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        background
        @prev-click="prev"
        @next-click="next"
        :current-page.sync="pagination.page"
        :page-size="pagination.per_page"
        layout="total, prev, pager, next"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import { getCheckLogList } from "@/api/product/index";
export default {
  data() {
    return {
      ser: {},
      pagination: {
        per_page: 10,
        page: 1,
      },
      total: 0,
      dataList:[]
    };
  },
  mounted() {
    this.get_CheckLogList();
  },
  methods: {
    get_CheckLogList() {
      getCheckLogList().then((res) => {
        this.dataList = res.data.data;
          this.total = res.data.total;
      });
    },
    company_name_click(type) {
      if (type == 0) {
        this.pagination.per_page = 10;
        this.pagination.page = 1;
      }
      getCheckLogList({ ...this.ser, ...this.pagination }).then((res) => {
        if (res.code == 200) {
          this.dataList = res.data.data;
          this.total = res.data.total;
        }
      });
    },
    company_name_clicks() {
      this.ser.company_name = "";
      getCheckLogList(this.pagination).then((res) => {
        if (res.code == 200) {
          this.dataList = res.data.data;
          this.total = res.data.total;
        }
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pagination.page = val;
      this.get_CheckLogList();
    },
    prev() {
      this.pagination.page = this.pagination.page - 1;
      this.get_CheckLogList();
    },
    next() {
      this.pagination.page = this.pagination.page + 1;
      this.get_CheckLogList();
    },
  },
};
</script>
<style lang=""></style>
